export default {
    namespaced: true,
    state: {
        // 控制提示组件显示隐藏
        isShowToast: false,
        toastMsg: 'vuex的内容',
        toastType: "success"
    },
    mutations: {
        // 改变提示组件状态
        changeIsShowToast(state, payload) {
            state.isShowToast = payload.showToast,
                state.toastMsg = payload.title,
                state.toastType = payload.type
        }
    },
    actions: {
        asyncToast(context, payload) {
            context.commit('changeIsShowToast', payload)
            // 两秒后消失
            setTimeout(() => {
                context.commit('changeIsShowToast', {
                    showToast: false
                })

            }, 2000);
        }
    }
}